package com.whiteape.book.model.dto;

import com.whiteape.book.utils.GsonUtils;

import org.greenrobot.greendao.converter.PropertyConverter;

import java.io.Serializable;
import java.util.Map;

public class SiteSourceSearchBean implements PropertyConverter<SiteSourceSearchBean, String>, Serializable {
    /**
     * 搜索链接
     */
    private String url;

    /**
     * 请求方法，默认GET
     */
    private String requestMethod;

    /**
     * 请求参数的编码方式，utf-8或者gbk
     */
    private String charset;

    /**
     * 请求参数
     */
    private Map<String, String> params;

    /**
     * 请求头
     */
    private Map<String, String> headers;

    /**
     * 搜索结果处理规则的bean
     */
    private SiteSourceSearchResultBean result;

    @Override
    public SiteSourceSearchBean convertToEntityProperty(String databaseValue) {
        return GsonUtils.string2Obj(databaseValue, SiteSourceSearchBean.class);
    }

    @Override
    public String convertToDatabaseValue(SiteSourceSearchBean entityProperty) {
        return GsonUtils.obj2String(entityProperty);
    }

    public String getUrl() {
        return url;
    }

    public void setUrl(String url) {
        this.url = url;
    }

    public String getRequestMethod() {
        return requestMethod;
    }

    public void setRequestMethod(String requestMethod) {
        this.requestMethod = requestMethod;
    }

    public String getCharset() {
        return charset;
    }

    public void setCharset(String charset) {
        this.charset = charset;
    }

    public Map<String, String> getParams() {
        return params;
    }

    public void setParams(Map<String, String> params) {
        this.params = params;
    }

    public Map<String, String> getHeaders() {
        return headers;
    }

    public void setHeaders(Map<String, String> headers) {
        this.headers = headers;
    }

    public SiteSourceSearchResultBean getResult() {
        return result;
    }

    public void setResult(SiteSourceSearchResultBean result) {
        this.result = result;
    }
}
